package com.share;

import com.share.annotate.Mapper;
import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.core.type.filter.AnnotationTypeFilter;

import java.util.Set;

/**
 * author:caifan
 * date:2019/9/3
 */
public class MyClassPathScanner extends ClassPathBeanDefinitionScanner {

    public MyClassPathScanner(BeanDefinitionRegistry registry) {
        super(registry);
    }

    public MyClassPathScanner(BeanDefinitionRegistry registry, Boolean defaultFilter) {
        super(registry, defaultFilter);
    }

    @Override
    protected void registerDefaultFilters() {
        addIncludeFilter(new AnnotationTypeFilter(Mapper.class));
    }

    @Override
    protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
        return super.doScan(basePackages);
    }


}
